<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册会员</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/Theme1/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/static/plupload/upfiless.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/Theme1/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/Theme1/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"
          rel="stylesheet">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>注册会员信息 <a href="__URL__/lists" style="margin-left:15px; color:#06cbc4">会员列表</a></h5>
                    <div class="ibox-tools">

                    </div>
                </div>
                <div class="ibox-content">
                    <form method="post" action="__URL__/Add_Action" class="form-horizontal" id="form-admin-add"
                          enctype="multipart/form-data">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">会员编号</label>
                            <div class="col-sm-3">

                                <input type="text" class="form-control" name="txt_loginname1" id="txt_loginname1"
                                       onBlur="fmCheckUserName('txt_loginname_msg',this.value,'恭喜,可以使用','对不起,该编号已经使用')"
                                       style="width:65%;" value="<{$bianhao}>" readonly/>

                                <input type="hidden" value="<{$bianhao}>" name="txt_loginname" id="txt_loginname"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">购买套餐</label>
                            <div class="col-sm-3">
                                <select name="txt_goods_id" id="txt_goods_id">
                                    <!--<option value="0">请选择套餐</option>-->
                                    <foreach name="goods_info" item="item">
                                        <option value="<{$item.goods_id}>"><{$item.goods_name}></option>
                                    </foreach>
                                </select>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">收货地址</label>
                            <div class="col-sm-3">
                                <input type="text" name="txt_address" id="address" class="form-control"
                                       placeholder="请按照省/市/区/街道/小区/门牌号填写,按该地址发货,否则概不负责"
                                       onblur="check_dizhi(this.value)">
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">会员姓名</label>
                            <div class="col-sm-3">
                                <input type="text" name="txt_truename" id="txt_truename" class="form-control"
                                       onblur="check_truename(this.value)">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">身份证号</label>
                            <div class="col-sm-3">
                                <input type="text" name="txt_identityid" id="txt_identityid" class="form-control"
                                       onBlur="is_identityid(this.value)" placeholder="必须实名且唯一，虚假信息后台升级后将会被冻结账号"/>
                            </div>

                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">手机号码</label>
                            <div class="col-sm-3">
                                <input type="text" name="txt_tel" id="txt_tel" class="form-control"
                                       onBlur="shoujihaoma(this.value)"/>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">推荐人</label>
                            <div class="col-sm-3">
                                <input type="text" name="txt_rid" id="txt_rid" class="form-control"
                                       onBlur="is_tuijian(this.value)" value="<{$_SESSION['nvip_nvip_member_User']}>">
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">接点人</label>
                            <div class="col-sm-3">
                                <input type="text" name="txt_pid" id="txt_pid" value="<{$jiedianren}>"
                                       class="form-control" onBlur="is_jiedian(this.value)">
                            </div>
                        </div>
                        <div class="form-group">

                            <label class="col-sm-1 control-label">接点位置</label>
                            <div class="col-sm-3">
                                <input name="txt_area" id="txt_areaaqu" type="radio" value="1"
                                <if condition="$jiedian_area eq 1">checked</if>
                                onclick="is_aqu(this.value)">一部
                                <input name="txt_area" id="txt_areabqu" type="radio" value="2"
                                <if condition="$jiedian_area eq 2">checked</if>
                                onclick="is_bqu(this.value)">二部
                                <input name="txt_area" id="txt_areacqu" type="radio" value="3"
                                <if condition="$jiedian_area eq 3">checked</if>
                                onclick="is_cqu(this.value)">三部<span style="color: #1AB394">  (六星总监以上才可开拓三部市场)</span>
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">登陆密码</label>
                            <div class="col-sm-3">
                                <input type="text" name="txt_pwd1" id="txt_pwd1" class="form-control">
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">二级密码</label>
                            <div class="col-sm-3">
                                <input type="text" name="txt_pwd2" id="txt_pwd2" class="form-control">
                            </div>

                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">注册会员</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="__PUBLIC__/Theme1/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/Theme1/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/Theme1/js/plugins/iCheck/icheck.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/jquery.validate.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/messages_zh.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/validate-methods.js"></script>
<script type="text/javascript" src="__PUBLIC__/Theme1/lib/webuploader/0.1.5/webuploader.min.js"></script>

<script>
    $(document).ready(function () {
        $(".i-checks").iCheck({checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green",});
    });
</script>
<script type="text/javascript">
    function check_dizhi(dizhi) {
        if (dizhi == '') {
            $('#address').val('').focus();
        }
        if ($('#txt_goods_id').val() == '0') {
            alert('请先选择套餐');
            $('#txt_goods_id').focus();
        }
    }
    function check_truename(truename) {
        if (truename == '') {
            $('#txt_truename').val('').focus();
        }

        if ($('#address').val() == '') {
            $('#address').val('').focus();
        }
    }
    function shoujihaoma(thisvalue) {

        var reg = /^\d{9,}$/;

        $("#txt_tel-error").remove();
        if (!reg.test(thisvalue)) {
            $("#txt_tel").addClass("error");
            $("#txt_tel").after('<label id="txt_tel-error" class="error" for="txt_tel" style="display: inline-block;">格式不正确</label>');

            return false;
        }
        else {
            $("#txt_tel").removeClass("error");
            return true;
        }


    }

    function is_taobao(thisvalue) {

        if (txt_taobao.value == "") {
            $("#txt_taobao").addClass("error");
            $("#txt_taobao").after('<label id="txt_taobao-error" class="error" for="txt_taobao" style="display: inline-block;">请填写淘宝账号</label>');

            return false;
        }
        else {
            $("#txt_taobao").removeClass("error");
            return true;
        }


    }

    function is_zhifubao(thisvalue) {

        if (txt_zhifubao.value == "") {
            $("#txt_zhifubao").addClass("error");
            $("#txt_zhifubao").after('<label id="txt_zhifubao-error" class="error" for="txt_zhifubao" style="display: inline-block;">请填写支付宝账号</label>');

            return false;
        }
        else {
            $("#txt_zhifubao").removeClass("error");
            return true;
        }


    }

    function is_zfbname(thisvalue) {

        if (txt_zfbname.value == "") {
            $("#txt_zfbname").addClass("error");
            $("#txt_zfbname").after('<label id="txt_zfbname-error" class="error" for="txt_zfbname" style="display: inline-block;">请填写支付宝姓名</label>');

            return false;
        }
        else {
            $("#txt_zfbname").removeClass("error");
            return true;
        }


    }

    function is_bank(thisvalue) {

        if (txt_bank.value == "") {
            $("#txt_bank").addClass("error");
            $("#txt_bank").after('<label id="txt_bank-error" class="error" for="txt_bank" style="display: inline-block;">请填写开户行</label>');

            return false;
        }
        else {
            $("#txt_bank").removeClass("error");
            return true;
        }


    }
    function is_bankno(thisvalue) {

        if (txt_bankno.value == "") {
            $("#txt_bankno").addClass("error");
            $("#txt_bankno").after('<label id="txt_bankno-error" class="error" for="txt_bankno" style="display: inline-block;">请填写身份证号</label>');

            return false;
        }
        else {
            $("#txt_bankno").removeClass("error");
            return true;
        }
    }
    function is_identityid(thisvalue) {

        if (txt_identityid.value == "") {
            $("#txt_identityid").addClass("error");
            $("#txt_identityid").after('<label id="txt_identityid-error" class="error" for="txt_identityid" style="display: inline-block;">请填写身份证号</label>');

            return false;
        }
        else {
            $("#txt_identityid").removeClass("error");
            return true;
        }


    }

    function is_truename(thisvalue) {

        if (txt_truename.value == "") {
            $("#txt_truename").addClass("error");
            $("#txt_truename").after('<label id="txt_truename-error" class="error" for="txt_truename" style="display: inline-block;">请填写银行卡开户姓名</label>');

            return false;
        }
        else {
            $("#txt_truename").removeClass("error");
            return true;
        }


    }

    function is_bankaddress(thisvalue) {

        if (txt_bankaddress.value == "") {
            $("#txt_bankaddress").addClass("error");
            $("#txt_bankaddress").after('<label id="txt_bankaddress-error" class="error" for="txt_bankaddress" style="display: inline-block;">请填写银行卡开户地址</label>');

            return false;
        }
        else {
            $("#txt_bankaddress").removeClass("error");
            return true;
        }


    }


    function is_tuijian(thisvalue) {
        if (thisvalue.length > 0) {
            $("#is_tuijian-error").remove();
            htmlobj = $.ajax({url: "__URL__/CheckTuijian?username=" + escape(thisvalue), async: false});
            if (escape(htmlobj.responseText) == "0") {

                $("#txt_rid").addClass("error");
                $("#txt_rid").val('').focus();
                $("#txt_rid").after('<label id="is_tuijian-error" class="error" for="txt_rid" style="display: inline-block;">推荐人不存在或未激活</label>');

                return false;
            }
            if (escape(htmlobj.responseText) == "1") {
                $("#txt_rid").removeClass("error");
                return true;
            }
        }


    }

    //判断接点人

    function is_jiedian(thisvalue) {
        if (thisvalue.length > 0) {
            $("#is_jiedian-error").remove();
            htmlobj = $.ajax({url: "__URL__/CheckJieDian?username=" + escape(thisvalue), async: false});

            if (escape(htmlobj.responseText) == "0") {

                $("#txt_pid").addClass("error");
                $("#txt_pid").after('<label id="is_jiedian-error" class="error" for="txt_pid" style="display: inline-block;">接点人不存在或未激活</label>');

                return false;
            }
            if (escape(htmlobj.responseText) == "1") {
                $("#txt_pid").removeClass("error");
                return true;
            }
        }

    }


    //安放区域
    function is_aqu(thisvalue) {
        var jiedian = $("#txt_pid").val();
        if (thisvalue.length > 0) {
            $("#is_aqu-error").remove();
            htmlobj = $.ajax({url: "__URL__/CheckAqu?username=" + escape(jiedian), async: false});
            if (escape(htmlobj.responseText) == "0") {
                // alert('xxx11');
                $("#txt_areaaqu").addClass("error");
                $("#txt_areaaqu").after('<label id="txt_areaaqu-error" class="error" for="txt_area" style="display: inline-block;">一部已被占用</label>');
                $("#txt_pid").val('').focus();
                return false;
            }
            if (escape(htmlobj.responseText) == "1") {
                // alert('xxx22');
                $("#txt_areaaqu").removeClass("error");
                return true;
            }
        }

    }

    function is_bqu(thisvalue) {
        var jiedian = $("#txt_pid").val();
        if (thisvalue.length > 0) {
            $("#is_bqu-error").remove();
            htmlobj = $.ajax({url: "__URL__/CheckBqu?username=" + escape(jiedian), async: false});

            if (escape(htmlobj.responseText) == "0") {

                $("#txt_areabqu").addClass("error");
                $("#txt_areabqu").after('<label id="txt_areabqu-error" class="error" for="txt_area" style="display: inline-block;">二部已被占用</label>');
                $("#txt_pid").val('').focus();
                return false;
            }
            if (escape(htmlobj.responseText) == "1") {
                $("#txt_areabqu").removeClass("error");
                return true;
            }
        }

    }
    function is_cqu(thisvalue) {
        var jiedian = $("#txt_pid").val();
        if (thisvalue.length > 0) {
            $("#is_cqu-error").remove();
            htmlobj = $.ajax({url: "__URL__/CheckCqu?username=" + escape(jiedian), async: false});

            if (escape(htmlobj.responseText) == "0") {
                $("#txt_areacqu").addClass("error");
                $("#txt_areacqu").after('<label id="txt_areacqu-error" class="error" for="txt_area" style="display: inline-block;">三部已被占用</label>');
                $("#txt_pid").val('').focus();
                return false;
            }
            if (escape(htmlobj.responseText) == "1") {
                $("#txt_areacqu").removeClass("error");
                return true;
            }
            if (escape(htmlobj.responseText) == "2") {
                $("#txt_areacqu").addClass("error");
                $("#txt_areacqu").after('<label id="txt_areacqu-error" class="error" for="txt_area" style="display: inline-block;">未达到七星总监,不能选择三部</label>');
                $("#txt_pid").val('').focus();
                return false;
            }
        }

    }


    $(function () {

        $("#form-admin-add").validate({
            rules: {
                txt_loginname1: {
                    required: true,
                    minlength: 1,
                    maxlength: 8
                },
                txt_bankname: {
                    required: true,
                    minlength: 1,
                    maxlength: 16
                },

                txt_rid: {
                    required: true,
                    minlength: 1,
                    maxlength: 16
                },
                txt_pid: {
                    required: true,
                    minlength: 1,
                    maxlength: 16
                },
                txt_area: {
                    required: true,
                    minlength: 1,
                    maxlength: 5
                },

                txt_tel: {
                    required: true,
                    minlength: 7,
                    maxlength: 11
                },
                txt_pwd1: {
                    required: true,
                    minlength: 6,
                    maxlength: 20
                },
                txt_pwd2: {
                    required: true,
                    minlength: 6,
                    maxlength: 20
                },
                txt_taobao: {
                    required: true,
                    minlength: 2,
                    maxlength: 30
                },
                txt_zhifubao: {
                    required: true,
                    minlength: 2,
                    maxlength: 30
                },
                txt_zfbname: {
                    required: true,
                    minlength: 2,
                    maxlength: 8
                },
                txt_bank: {
                    required: true,
                    minlength: 2,
                    maxlength: 20
                },
                txt_bankno: {
                    required: true,
                    minlength: 10,
                    maxlength: 35
                },
                txt_identityid: {
                    required: true,
                    minlength: 10,
                    maxlength: 35
                },
                txt_truename: {
                    required: true,
                    minlength: 2,
                    maxlength: 8
                },
                txt_bankaddress: {
                    required: true,
                    minlength: 2,
                    maxlength: 30
                }


            },

            onkeyup: false,
            focusCleanup: true,
            success: "valid",
            submitHandler: function (form) {

                if (is_tuijian($("#txt_rid").val()) && shoujihaoma($("#txt_tel").val())) {

                    $(form).ajaxSubmit();
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.$('.btn-refresh').click();
                    parent.layer.close(index);
                }

                if (is_tuijian($("#txt_pid").val())) {

                    $(form).ajaxSubmit();
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.$('.btn-refresh').click();
                    parent.layer.close(index);
                }


            }
        });
    });
</script>

</body>

</html>
